<?php
/*
 *  A Part of snock project
 *   Author king-of-war
 * Last modified 2009-4-5
 */
@session_start();
echo '<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />';
include_once 'smarty_config.php';
include_once 'class/verify.class.php';
include_once 'class/error.class.php';
$a=new verify('../');
$errmsg=new Errmsg();
/*
 * check the result of function isMember to verify the passport
 */

if(isset($_POST['submit'])){
	$cap=$_POST['captcha'];
$captcha=$_SESSION['captcha'];

	if($cap==$captcha){
		$right=$a->isMember($_POST['name'],$_POST['pass']);
		if($right){
			$info= '<h1>登录成功</h1><br/>转向<a href="index.php">管理页面</a>';
					$errmsg->error_chinese($info);
					echo '<META HTTP-EQUIV="Refresh" CONTENT="2;URL=index.php">' ;
					exit;

		}else{
			$info= '用户名或密码错误<br><br>将在3秒钟内转向登录页面';
			$errmsg->error_chinese($info);
			echo '<META HTTP-EQUIV="Refresh" CONTENT="3;URL=login.php">' ;
			exit;
		}
	}else{
		$info= '验证码错误<br><br>将在3秒钟内转向登录页面 patcha';
		$errmsg->error_chinese($info);
		echo '<META HTTP-EQUIV="Refresh" CONTENT="3;URL=login.php">' ;
		exit;
	}
}else{

}

$title='snock项目';
$smarty->assign("title",$title);
$smarty->display("login.html");

?>

